package cn.itcast.nems.approval.service.impl;

import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import cn.itcast.nems.approval.dao.entity.ApprovalConfig;
import cn.itcast.nems.approval.dao.mapper.ApprovalConfigMapper;
import cn.itcast.nems.approval.service.ApprovalConfigService;

/**
 * <p>
 * 流程审批单配置 服务实现类
 * </p>
 *
 * @author 刘曙
 * @since 2023-11-22
 */
@Service
public class ApprovalConfigServiceImpl extends ServiceImpl<ApprovalConfigMapper, ApprovalConfig> implements ApprovalConfigService {
    
    @Override
    public ApprovalConfig getByJournalCode(String journalCode) {
        // TODO 加缓存！
        LambdaQueryWrapper<ApprovalConfig> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(ApprovalConfig::getJournalCode, journalCode).last(" limit 1 ");
        return this.getBaseMapper().selectOne(queryWrapper);
    }
}
